package com.jueming.miser.ware.controller;

import java.util.Arrays;
import java.util.Map;
//
//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jueming.miser.ware.entity.MiserWareEntity;
import com.jueming.miser.ware.service.MiserWareService;
import com.jueming.miser.common.utils.PageUtils;
import com.jueming.miser.common.utils.R;



/**
 * 
 *
 * @author jueming
 * @email jueming@qq.com
 * @date 2022-10-04 10:45:39
 */
@RestController
@RequestMapping("ware/miserware")
public class MiserWareController {
    @Autowired
    private MiserWareService miserWareService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = miserWareService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{wareId}")
    
    public R info(@PathVariable("wareId") Integer wareId){
		MiserWareEntity miserWare = miserWareService.getById(wareId);

        return R.ok().put("miserWare", miserWare);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    
    public R save(@RequestBody MiserWareEntity miserWare){
		miserWareService.save(miserWare);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    
    public R update(@RequestBody MiserWareEntity miserWare){
		miserWareService.updateById(miserWare);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    
    public R delete(@RequestBody Integer[] wareIds){
		miserWareService.removeByIds(Arrays.asList(wareIds));

        return R.ok();
    }

}
